package com.mdlib.helper.ui.adapter;

import android.widget.RatingBar;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ljlib.core.util.common.TimeUtils;
import com.ljlib.help.R;
import com.mdlib.helper.model.entity.ServiceStartInfo;

import java.util.List;

/**
 * 作者：HQY on 16/11/30 13:17
 * 邮箱：hqy_xz@126.com
 */

public class ServiceStartAdapter extends BaseQuickAdapter<ServiceStartInfo> {

    public ServiceStartAdapter(List<ServiceStartInfo> data) {
        super(R.layout.item_service_start, data);

    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, ServiceStartInfo serviceStartInfo) {

        RatingBar serviceLevel = baseViewHolder.getView(R.id.rb_rush_service_level);
        serviceLevel.setNumStars(serviceStartInfo.getStars());
        serviceLevel.setRating(serviceStartInfo.getStars());

        baseViewHolder.setText(R.id.tv_start_day, TimeUtils.milliseconds2String(Long.valueOf(serviceStartInfo.getCreate_time()) * 1000, TimeUtils.YEARS));
        baseViewHolder.setText(R.id.tv_start_hour, TimeUtils.milliseconds2String(Long.valueOf(serviceStartInfo.getCreate_time()) * 1000, TimeUtils.HOURS));
        baseViewHolder.setText(R.id.tv_start_name, serviceStartInfo.getUsername());


    }
}
